/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import model.dao.util.MySqlDataAccessHelper;
import model.pojo.FilterRam;

/**
 *
 * @author TiOc
 */
public class FilterRamDAO 
{
    public static ArrayList<FilterRam> getFilterRam()
    {
        ArrayList<FilterRam> ds = new ArrayList<FilterRam>();
        String sql = "SELECT * FROM FilterRam As fr WHERE fr.isPublish = '1' ORDER BY fr.sizeRam";
        MySqlDataAccessHelper helper = new MySqlDataAccessHelper();
        helper.open();
        ResultSet rs = helper.executeQuery(sql); 
        try
        {
            while(rs.next())
            {
                FilterRam fr = new FilterRam();
                fr.setIdFilterRam(rs.getInt("idFilterRam"));
                fr.setSizeRam(rs.getInt("sizeRam"));
                fr.setIsPublish(rs.getInt("isPublish"));
                ds.add(fr);
            }
        }
        catch(SQLException ex)
        {
            System.out.println(ex.getMessage());
        }
        helper.close();
        
        return ds;
    }
}
